package com.component;

import javax.swing.JDialog;
import javax.swing.JFrame;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.Map;

import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;

import com.db.service.GroupServer;

/**
 * 一个用来新建组或者作业的小控件
 * 
 * @author 28102
 *
 */
public class GetNewGroup extends JDialog {
	public JTextField textField_1;
	public JTextArea textArea;
	public JButton btnNewButton;
	
//	private static class SingletonClassInstance{
//       private static final GetNewGroup instance=new GetNewGroup();
//	}
//	public static GetNewGroup getInstance(){
//         return SingletonClassInstance.instance;
//	}
	
	private void Mdispose() {
		this.dispose();
	}

	public GetNewGroup(JFrame jf, String title, boolean modal) {
		super(jf, title, modal);
		System.out.println("启动添加组件");
		setVisible(true);
	}

	public GetNewGroup() {
		getContentPane().setLayout(null);

		btnNewButton = new JButton("确定");
		btnNewButton.setBounds(58, 211, 75, 35);
		getContentPane().add(btnNewButton);
		

		JButton btnNewButton_1 = new JButton("取消");
		btnNewButton_1.setBounds(179, 211, 75, 35);
		getContentPane().add(btnNewButton_1);
		btnNewButton_1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				Mdispose();
			}
		});

		JLabel lblNewLabel = new JLabel("名称：");
		lblNewLabel.setBounds(46, 7, 54, 15);
		getContentPane().add(lblNewLabel);

		textField_1 = new JTextField();
		textField_1.setBounds(43, 32, 219, 21);
		getContentPane().add(textField_1);
		textField_1.setColumns(10);

		textArea = new JTextArea();
		textArea.setLineWrap(true);
		// textArea.setWrapStyleWord(true); //断字

		textArea.setVisible(true);
		JScrollPane jsPane1 = new JScrollPane(textArea);
		jsPane1.setBounds(46, 91, 216, 98);
		jsPane1.setVisible(true);
		getContentPane().add(jsPane1);

		JLabel lblNewLabel_1 = new JLabel("详情/备注：");
		lblNewLabel_1.setBounds(46, 66, 75, 15);
		getContentPane().add(lblNewLabel_1);
		this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		// this.addWindowListener((WindowListener) this);
		this.setTitle("123");
		this.getContentPane().setLayout(null);
		this.setSize(332, 295);
		this.setLocationRelativeTo(null);
		this.setVisible(true);
	};

	public static void main(String[] args) {
		new GetNewGroup().setVisible(true);
	}

}
